package com.g8.pethospitallearnbackend.mapper;

import com.g8.pethospitallearnbackend.entity.ExamIntern;
import com.g8.pethospitallearnbackend.entity.ExamInternExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface ExamInternMapper {
    @SelectProvider(type=ExamInternSqlProvider.class, method="countByExample")
    long countByExample(ExamInternExample example);

    @DeleteProvider(type=ExamInternSqlProvider.class, method="deleteByExample")
    int deleteByExample(ExamInternExample example);

    @Insert({
        "insert into exam_intern (exam_id, user_id, ",
        "enter_time, grade)",
        "values (#{examId,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, ",
        "#{enterTime,jdbcType=TIMESTAMP}, #{grade,jdbcType=INTEGER})"
    })
    int insert(ExamIntern record);

    @InsertProvider(type=ExamInternSqlProvider.class, method="insertSelective")
    int insertSelective(ExamIntern record);

    @SelectProvider(type=ExamInternSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="exam_id", property="examId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="enter_time", property="enterTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER)
    })
    List<ExamIntern> selectByExample(ExamInternExample example);

    @UpdateProvider(type=ExamInternSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ExamIntern record, @Param("example") ExamInternExample example);

    @UpdateProvider(type=ExamInternSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ExamIntern record, @Param("example") ExamInternExample example);
}